package com.reyco1.medusa.util
{
	public class KeyUtil
	{
		public static const A : uint = 65;
		public static const B : uint = 66;
		public static const C : uint = 67;
		public static const D : uint = 68;
		public static const E : uint = 69;
		public static const F : uint = 70;
		public static const G : uint = 71;
		public static const H : uint = 72;
		public static const I : uint = 73;
		public static const J : uint = 74;
		public static const K : uint = 75;
		public static const L : uint = 76;
		public static const M : uint = 77;
		public static const N : uint = 78;
		public static const O : uint = 79;
		public static const P : uint = 80;
		public static const Q : uint = 81;
		public static const R : uint = 82;
		public static const S : uint = 83;
		public static const T : uint = 84;
		public static const U : uint = 85;
		public static const V : uint = 86;
		public static const W : uint = 87;
		public static const X : uint = 88;
		public static const Y : uint = 89;
		public static const Z : uint = 90;
		
		public static const ZERO 	: uint = 96;
		public static const ONE 	: uint = 97;
		public static const TWO 	: uint = 98;			 
		public static const THREE 	: uint = 99;
		public static const FOUR 	: uint = 100;
		public static const FIVE 	: uint = 101;
		public static const SIX 	: uint = 102;
		public static const SEVEN 	: uint = 103;
		public static const EIGHT 	: uint = 104;
		public static const NINE 	: uint = 105;
		
		public static const DIVIDE 	: uint = 47;
		public static const MULTIPLY: uint = 42;
		public static const SUBTRACT: uint = 45;
		public static const ADD 	: uint = 43;
		public static const DECIMAL : uint = 46;
		
		public static const LEFT 	: uint = 37; 
		public static const UP 		: uint = 38;
		public static const RIGHT 	: uint = 39;
		public static const DOWN 	: uint = 40;
		
		public static const SPACE : uint = 32; 
		
		private static const CODE : Array = [A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,ZERO,ONE,TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,NINE,DIVIDE,MULTIPLY,SUBTRACT,ADD,DECIMAL,SPACE];
		private static const CHAR : Array = "abcdefghijklmnopqrstuvwxyz0123456789/*-+. ".split("");
		
		public static const KONAMI : Array = [	UP, UP, DOWN, DOWN, LEFT, RIGHT, LEFT, RIGHT, B, A ];
		
		public static function getKeyCodes(str:String):Array 
		{			
			var chars:Array = str.toLowerCase().split("");
			var codes:Array = [];			
			for (var i:int = 0; i < chars.length; i++) 
			{
				var curChar:String = chars[i];
				for (var j:int = 0; j < CHAR.length; j++) 
				{
					if(curChar == CHAR[j])
					{
						codes.push(CODE[j]);
					} 
				} 
			}
			return codes;
		}
	}
}